package com.ruoyi.hr.service.impl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.hr.domain.Departments;
import com.ruoyi.hr.domain.Jobs;
import com.ruoyi.hr.mapper.DepartmentsMapper;
import com.ruoyi.hr.mapper.JobsMapper;
import com.ruoyi.hr.service.DepartmentsService;
import com.ruoyi.hr.service.JobsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JobsServiceImpl implements JobsService {
    @Autowired
    private JobsMapper jobsMapper;

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Jobs> findJobs(Long depID) {
        return jobsMapper.findJobs(depID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Jobs> findAll(int PageNum, int PageSize, Jobs jobs,List<String> AllID) {
        return jobsMapper.findAll((PageNum - 1) * PageSize,PageSize,jobs,AllID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int findCount(Jobs jobs,List<String> AllID) {
        return jobsMapper.findCount(jobs,AllID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Jobs findJobsOne(Long jobID) {
        return jobsMapper.findJobsOne(jobID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Jobs> findJobsAll() {
        return jobsMapper.findJobsAll();
    }


    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int updateJobs(Jobs jobs) {
        return jobsMapper.updateJobs(jobs);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int insertJobs(Jobs jobs) {
        return jobsMapper.insertJobs(jobs);
    }


    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Jobs findadminJob(Long jobID) {
        return jobsMapper.findadminJob(jobID);
    }
}
